// 上传文件的接口
// Key 文件名
// FilePath 文件路径（一般应该是上传的文件对象中的路径）
import {upload} from "~/server/cos-index";

export default defineEventHandler(async (event) => {
    const method = event.node.req.method
    if (method === 'GET') {
        const query = getQuery(event)
        return {
            query
        }
    } else {
        const body = await readBody(event)
        await upload(<string>body.Key, <string>body.FilePath)
        return {
            body,
        }
    }
})